<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>对象方法的扩展</title>
</head>
<body>
<script>
    // 1. Object.is 判断两个值是否完全相等  与全等号相似(===)
    console.log(Object.is(120, 120))//true
    console.log(Object.is(NaN, NaN))//true
    console.log(NaN === NaN)   // false

    // 2. Object.assign 对象的合并   有相同属性会被覆盖
    const obj1={
        name:'张三',
        age:15,
        sex:'男'
    }
    const obj2={
        height:165,
        weight:200
    }
    console.log(Object.assign(obj1,obj2))

    // 3. Object.setPrototypeOf 设置对象原型    Object.getPrototypeOf 获取原型
    const Person1={
        name:'liSi',
        age:16,
        sex:'woman'
    }
    const Person2={
        name:'wangWu',
        age:20,
        sex:'man'
    }
    Object.setPrototypeOf(Person2,Person1)//设置原型对象
    console.log(Object.getPrototypeOf(Person1))//获取原型对象
    console.log(Person1)
</script>
</body>
</html>